﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Reflection;

namespace OPLService
{
    public class NotificationDetails:IJsonSerialize
    {
        #region Private Members
        private int _id;
        private string _description;
        private string _caption;
        private DateTime? _notifiedOn;
        #endregion
        
        public int Id
        {
            get
            {
                return _id;
            }
            set
            {
                _id = value;
            }
        }

        public string Caption
        {
            get
            {
                return _caption;
            }
            set
            {
                _caption = value;
            }
        }

        public string Description
        {
            get
            {
                return _description;
            }
            set
            {
                _description = value;
            }
        }

        public DateTime? NotifiedOn
        {
            get
            {
                return _notifiedOn;
            }
            set
            {
                _notifiedOn = value;
            }
        }

        public string Serialize()
        {
            string serializedString = string.Empty;
            PropertyInfo[] properties=this.GetType().GetProperties();

            foreach (PropertyInfo pi in properties)
            {
                serializedString += "'" + pi.Name + "':'" + pi.GetValue(this, null).ToString() + "',";
            }
         //   serializedString = "{"Error":0,"ErrorMessage?":"","Result":[{" + serializedString.TrimEnd(",".ToCharArray()) + "}]";
            return serializedString;
        }
    }
}